package com.usefullc.system.dao;

import com.usefullc.system.domain.SerialNumber;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author: Sampson
 * @date: 2022-04-16 17:13
 */
public interface SerialNumberDao extends JpaRepository<SerialNumber, Long> {

    @Transactional
    @Modifying
    @Query(value = "update `sys_serial_number` t set t.no = t.no + 1 where t.id = ?1 ",nativeQuery = true)
    int incrNo(Long id);
}
